package com.itheima.UDP.UDP发送协议;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.Scanner;

public class ClientDemo3 {
    public static void main(String[] args) throws IOException {
        DatagramSocket ds = new DatagramSocket();
        Scanner sc=new Scanner(System.in);

        while (true) {
            String s=sc.nextLine();
            if ("886".equals(s)){
            break;
            }
            byte[] bys = s.getBytes();
            InetAddress address = InetAddress.getByName("127.0.0.1");
            int port=120;
            DatagramPacket dp = new DatagramPacket(bys, bys.length, address, port);
            // DatagramPacket dp=new DatagramPacket(s.getBytes(),s.getBytes().length, InetAddress.getByName("192.168.18.22"),10010);
               ds.send(dp);

        }

       ds.close();
        //组播地址
        //224.0.1.0
    }
}
